import javax.security.auth.callback.CallbackHandler;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

/**
 * @作者: xiaoxun
 * @日期: 2025/3/11 18:30
 * @描述:
 */
public class FileReaderDemo02 {
	public static void main(String[] args) throws IOException {
		Reader fr = null;
		try {
			 fr=new FileReader("Day10/src/java.txt");
			//定义字符数组用于读取多个字符
			char[] chars=new char[3];
			int len;
			while ((len=fr.read(chars))!=-1){
				String str=new String(chars,0,len);
				System.out.print(str);
			}

		}catch (Exception e){
			e.printStackTrace();
		}finally {
			fr.close();
			System.out.println("已关闭");
		}
	}
}
